package com.zhuhjay.web.controller;

import com.zhuhjay.common.annotation.ApiLimit;
import com.zhuhjay.common.annotation.AuthToken;
import com.zhuhjay.common.annotation.OperationLog;
import com.zhuhjay.common.domain.ResponseJson;
import com.zhuhjay.common.domain.controller.BaseController;
import com.zhuhjay.system.domain.entity.Menu;
import com.zhuhjay.system.service.IMenuService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

import static com.zhuhjay.common.domain.ResponseJson.success;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhuhjay
 * @since 2022-03-20
 */
@RestController
@RequestMapping("/system/menu")
public class MenuController extends BaseController {

    private final IMenuService menuService;
    public MenuController(IMenuService menuService){
        this.menuService = menuService;
    }

    @ApiLimit
    @AuthToken
    @OperationLog(operaDesc = "获取菜单列表", hasResult = false)
    @RequestMapping()
    public ResponseJson getMenus(){
        List<Menu> menus = menuService.getMenus();
        return success().appendData("menus", menus);
    }

}
